<?php

namespace Partner\Model;

use Utuo\UtuoModel;

class PartnerProductModel extends UtuoModel {
	
	// 楼盘状态
	public $status = array(
			0 => '禁止',
			1 => '正常' 
	);
	
	// 自动验证
	protected $_validate = array(
			array(
				'name',
				'require',
				'商城名称不能为空',
				self::EXISTS_VALIDATE 
			) 
	);
	
	protected $_auto = array(
			array('percent', 'getPersent', self::MODEL_BOTH, 'callback'),
	);
	
	// 获得分成
	public function getPersent() {
		$percent = $_REQUEST['partnerProduct']['percent'];
		if ( !isset($percent) ) {
			return false;
		}
		return join(':', $percent);
	}
	
}